package Control;

import java.util.ArrayList;

import javax.swing.JFrame;
import client.LibaryMain;
import Gui.LibrarianWindow;
import Gui.MainScreen;
import Logic.Users;
/**
 * this class runing the main tra
 * @author Ron Shenkerman
 * @author Gabi Revah
 * @author Aviad Almog
 * @author Ivan Onyshchenko
 */
public class UserLibrarian extends Users {

	private LibrarianWindow userWindow;
/**
 * crate new instance of labrarian
 * @param get userName
 * @param get password
 * @param get the UserLevel
 * @param get if  user connected
 */
	public UserLibrarian(String userName, String password, String UserLevel, Boolean connected) 
	{
		super(userName, password, UserLevel, connected);
		System.out.println("UserLibrarian constructor");
	}

	
	
/**
 * this method opend lanrarian window	
 */
	
	public void OpenWindow() //opens librarian window
	{
		
		System.out.println("SubscriberWindow: Open Window");
		System.out.println("SubscriberWindow: " + super.getUserName());
		userWindow= new LibrarianWindow();
		
		MainScreen.card.add("LibrarianWindow", userWindow);
		MainScreen.cardLayot.show(MainScreen.card, "LibrarianWindow");
		
	
	}

	/**
	 * send amessage to the server with client information
	 * @param get id
	 */
	
	public void viewsubscriberdeatil(String id){
		System.out.println("getting subscriber deatil");
		ArrayList<String> AddArray=new ArrayList<String>();
		
		AddArray.add("viewsubscriberetail");
		AddArray.add(id);
		//AddArray.add(password);
		LibaryMain.chat.handleMessageFromGui(AddArray);
		
		
	}



/**
 * adding new user to the data base
 * @param get id
 * @param get email
 * @param get name
 * @param get  tel
 * @param get  pass
 */

	public void AddNewSubscriber(String id, String email, String name,String tel, String pass) {

		System.out.println("Trying to build a user");
		ArrayList<String> AddArray=new ArrayList<String>();
		
		AddArray.add("AddUser");
		AddArray.add(id);
		AddArray.add(email);
		AddArray.add(name);
		AddArray.add(tel);
		AddArray.add(pass);
		LibaryMain.chat.handleMessageFromGui(AddArray);
		
		
	}
	


	
}
